package org.vectrics.company;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import org.vectrics.domain.Domain;
import org.vectrics.employee.Employee;
import org.vectrics.employee.JobTermReference;
import org.vectrics.recruiter.job.JobTerm;
import org.vectrics.user.Person;

public interface CompanyService {
	
	public Sector findSector(String code);
	public Collection findAllSectors();
	
	public Company findCompanyWithName(String companyName);
	
	public List findCompanyGroupTypes();
	public List findCompanyGroups(String code);
	public void updateRecruiters(List<Employee> recruiters);
	public void updateCompanyPersonGroup(CompanyPersonGroup companyPersonGroup);
	public void removeCompanyPersonGroup(CompanyPersonGroup companyPersonGroup);
	public CompanyPersonGroupType findCompanyGroupType(String code);
	
	public CompanyPersonRole findCompanyPersonRole(Long id);
	
	public CompanyPersonRoleType findCompanyPersonRoleType(String code);
	public int findCompanyCount(CompanySelectCriteria criteria);
	public List findCompanies(CompanySelectCriteria criteria, int startIndex, int endIndex);
	
	public int findCompanyPersonCount(CompanyPersonCriteria criteria);
	public List findCompanyPersons(CompanyPersonCriteria criteria, int startIndex, int endIndex);
    
	public CompanyPerson findCompanyPerson(Long companyPersonId);
    public CompanyPerson findCompanyPerson(Company company, Person person);
	public void updateCompanyPerson(CompanyPerson companyPerson);
	public void removeCompanyPerson(CompanyPerson companyPerson);
	
	public int findChildCompanyCount(Long parentId);
	public List findChildCompanies(Long parentId, int startIndex, int endIndex);
	
	public Company createCompany(Domain domain, String companyName, Company parent, Sector sector);
	public Company createCompanyAndDomain(String companyName, Company parent, Domain parentDomain, Sector sector);
	public Company findCompany(Long id);
	public Company updateCompany(Company updateCompany);
	public Company findCompanyWithReferenceId(String code);
	public void removeCompany(Company company);
	public List findCompanyUsers(Company company);
	public List findCompanyUsersForUser(Long userId);
	public CompanyPerson findCompanyPerson(Long companyId, Long personId);
	public void removeCompanyUser(Long companyId, Long personId);
	public void saveCompanyUser(CompanyPerson companyUser);
	public Set findCompanyPersonsForPerson(Person person);
	public Set findCompaniesForPerson(Person person);
	public Set findCompaniesForDomains(Set domains);
	
	public void updateCompanyPersonRole(CompanyPersonRole role);
	
	/**
	 * Busca todos los Empleados 
	 * @return Lista de los empleados
	 */
	public List<Employee> findAllEmployees();	
	
	
	/**
	 * Busca los CompanyPerson con el id de la persona
	 * @return empleado
	 */
	public CompanyPerson findEmployeeForIdPerson(Long idPerson);
	
	/**
	 * Busca todos las companias 
	 * @return lista de companias.
	 */
	public List<Company> findAllCompany();	
	
	/**
	 * Busca el Empleado con el id de la persona y el id de compania
	 * @return empleado
	 */
	public Employee findEmployee(Long idPerson, Long idCompany);
	
	/**
	 * Busca el Empleado con el id
	 * @return empleado
	 */
	public Employee findEmployee(Long id);
	
	/**
	 * Busca los posibles estados para el empleado.
	 * @return lista de posibles estados para el empleado.
	 */
	public List<JobTerm> findStatusForPersonId(Long idPerson, Long idCompany);
	
	/**
	 * Busca la referencia entre los term pasados por parametro.
	 * @param toJobTerm
	 * @param fromJobTerm
	 * @return La referencia entre los term pasados por parametro.
	 */
	public JobTermReference findJobTermReference(JobTerm toJobTerm, JobTerm fromJobTerm);
	
}
